﻿using Net5ApiANdWpfClient.Lib.Model.SystemAdmin;
using Net5ApiANdWpfClient.Lib.Service;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace WpfClient.OutsourceManger
{
    /// <summary>
    /// EditOutsource.xaml 的交互逻辑
    /// </summary>
    public partial class EditOutsource : Window
    {
        outsource outadmin = new outsource();

        //public int os_id { get; set; }
        public EditOutsource(int os_id)
        {
            InitializeComponent();
            OutsourceService outs = new OutsourceService();

            var result = outs.EditOutsource(os_id);

            outadmin = JsonConvert.DeserializeObject<outsource>(JsonConvert.SerializeObject(result.data));

            this.DataContext = outadmin;
        }
        private void UpdateBtn_Click(object sender, RoutedEventArgs e)
        {
            OutsourceService outs = new OutsourceService();
            string mess = "";
            bool result=outs.UpdateOutSource(outadmin,out mess);
            if (result)
            {
                MessageBox.Show($"修改{mess}!");
            }
            else
            {
                MessageBox.Show($"修改{mess}!");
            }
        }
        private void Closes_Click(object sender, RoutedEventArgs e)
        { 
        
        }
    }
}
